package com.lyzbbb.demo.miniapp.service.impl;

import com.lyzbbb.demo.miniapp.entity.Student;
import com.lyzbbb.demo.miniapp.repository.StudentRepository;
import com.lyzbbb.demo.miniapp.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Optional;

/**
 * 学生服务实现类
 */
@Service
public class StudentServiceImpl implements StudentService {

    private final StudentRepository studentRepository;
    
    @Autowired
    public StudentServiceImpl(StudentRepository studentRepository) {
        this.studentRepository = studentRepository;
    }

    @Override
    public Optional<Student> findById(String id) {
        return studentRepository.findById(id);
    }

    @Override
    public Student save(Student student) {
        return studentRepository.save(student);
    }
}